<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/3/29 0029
 * Time: 16:03
 */

namespace app\wap\controller;
use think\Db;

class Tripshoot extends Base
{
        public function index(){

          $is_china = intval(input('param.is_china'));
          $where ='is_del=0 and is_show=1 and sign="mobile"';
          if($is_china){
              $where .=' and is_china = '.$is_china;
              $this->assign('is_china',$is_china);
          }else{
              $this->assign('is_china',1);
          }
          $data = Db::name('qqlp')->where($where)->select();
          $this->assign('data',$data);
            //判断否有第二页的数据)
            $type =1;
            $next_data= Db::name('qqlp')->where($where)->page(2,10)->select();
            if(!$next_data){
                $type =2;
            }
            $this->assign('type',$type);
            return $this->fetch();
        }

    public function nr(){
        $id = intval(input('param.id'));
        if($id){
            $data = Db::name('qqlp')->where('id',$id)->find();
            $this->assign('data',$data);
        }


        return $this->fetch();
    }

    public  function  getmore()
    {
        $where = 'is_del=0 and is_show=1 and sign="pc"';
        $ids = input('post.idstr');
        $is_china = intval(input('param.is_china'));
        if ($is_china) {
            $where .= ' and is_china=' . $is_china;
        }
        $data = Db::name('qqlp')->where($where)->where('id', 'not in', $ids)->limit(10)->select();
        if ($data) {
            return json(['code' => 1, 'data' => $data]);
        } else {
            return json(['code' => 0, 'msg' => '没有更多了']);
        }
    }
}